package day16;
//通过实现Runnable接口  实现run()完成线程
    public class TestRunnable implements Runnable {
        public void run() {
            String name = Thread.currentThread().getName();
            for (int i = 0; i < 100; i++) {
                System.out.println(name+" "+i);
            }
        }
        public static void main(String[] args) {
            //run对象属于Runnabl类型的不是线程
            TestRunnable run = new TestRunnable();
            //Thread类型的对象才是线程 才能设置名称
            Thread t1 = new Thread(run,"万冲");
            Thread t2 = new Thread(run,"万辉");
            t1.start();
            t2.start();
        }
    }
